/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import ViteTsConfigPaths from 'vite-tsconfig-paths'
import path from 'path';

// 移除有问题的mock插件配置
export default defineConfig(() => ({
  root: __dirname,
  cacheDir: '../../node_modules/.vite/apps/web',
  server: {
    port:  4200,
    host: 'localhost',
  },
  preview: {
    port: 4300,
    host: 'localhost',
  },
  resolve: {
    alias: {
      '@my-workspace/shared': path.resolve(__dirname, '../../packages/shared/src'),
      '@my-workspace/hooks': path.resolve(__dirname, '../../packages/hooks/src'),
    },
  },
  
  plugins: [
    react(),
    ViteTsConfigPaths()
    // 暂时移除mock插件以解决错误
  ],
  build: {
    outDir: './dist',
    emptyOutDir: true,
    reportCompressedSize: true,
    commonjsOptions: {
      transformMixedEsModules: true,
    },
  },
}));
